<!DOCTYPE html>
<html>
  <head>
    <title>党员众筹 奎湖添绿 植树活动</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <link rel="stylesheet" href="${s.base}/mobile/css/weui.min.css">
    <link rel="stylesheet" href="${s.base}/mobile/css/jquery-weui.css">
    <link rel="stylesheet" href="${s.base}/mobile/css/base.css">
  </head>
  <body>
	<div class="xyg-comp-list-select">
       <div class="xyg-comp-list-select-item">
            <div class="xyg-comp-list-select-item-title"> 
             姓名
            </div>
            <div class="xyg-comp-list-select-item-content"> 
             <input type="text" placeholder="请先填写姓名" id="name" value="${member.name}" />
            </div>
       </div>
       <div class="xyg-comp-list-select-item">
            <div class="xyg-comp-list-select-item-title"> 
             性别
            </div>
           <input type="hidden" id="sex" value="${member.sex}"/>
           <div class="xyg-comp-list-select-item-icon" id="sexSelect">
               <span>${member.sex}</span>
               <svg class="icon" aria-hidden="true">
                   <use xlink:href="#icon-xiangyou"></use>
               </svg>
           </div>
       </div> 
       <div class="xyg-comp-list-select-item">
            <div class="xyg-comp-list-select-item-title"> 
             单位名称
            </div>
           <input type="hidden" id="grade" value="${member.grade}"/>
           <div class="xyg-comp-list-select-item-icon" id="gradeSelect">
               <span>${member.gradeName!'请选择'}</span>
               <svg class="icon" aria-hidden="true">
                   <use xlink:href="#icon-xiangyou"></use>
               </svg>
           </div>
       </div> 
       <div class="xyg-comp-list-select-item">
            <div class="xyg-comp-list-select-item-title"> 
             电话号码
            </div>
             <div class="xyg-comp-list-select-item-content"> 
             <input type="text" id="phone" placeholder="请先填写电话号码"  value="${member.phone}"/>
            </div>
       </div> 
       <div class="xyg-comp-list-select-item" style="margin-top: 0.5rem;">
            <div class="xyg-comp-list-select-item-title"> 
            </div>
             <div class="xyg-comp-list-select-item-content" style="text-align: right;"> 
             报名费用：<span style="color: #F00;">￥${activity.money}</span>
            </div>
       </div> 
  	</div>
   <div class="xyg-bottom">
       <#if activity.status=="1">
           <a href="javascript:;" class="weui-btn weui-btn_primary">活动未开始</a>
           <#elseif activity.status=="2">
               <a href="javascript:void(0);" id="submitBtn" class="weui-btn weui-btn_primary">支付并提交</a>
               <#elseif activity.status=="3">
                   <a href="javascript:;" class="weui-btn weui-btn_primary">活动已结束</a>
                   <#elseif activity.status=="4">
                       <a href="javascript:;" class="weui-btn weui-btn_primary">已经报名</a>
       </#if>
    </div>
    <!--<div style="width: 100%; height: 1rem;line-height: 1rem; text-align: center; margin-top:12rem; "><a href="http://www.wuhuit.net" style="color: #ccc; ">程序开发：芜湖荣森网络</a> </div>-->

    <style type="text/css">
	  html,body{background:#f5f5f5;}
  	.xyg-comp-list-select{width:100%; height:auto;}
	.xyg-comp-list-select-item{width:90%; padding:0px 5%; line-height:2.2rem; height:2.2rem;font-size: 0.8rem; color:#000; letter-spacing: 0.01rem; background: #FFF; border: 0.001rem solid #f5f5f5;}
	.xyg-comp-list-select-item .xyg-comp-list-select-item-icon{width:70%; line-height:2rem; text-align:right; float:left;overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;}
	.xyg-comp-list-select-item .xyg-comp-list-select-item-title{width:30%; height:2rem; text-align:left; float:left;overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;}
	.xyg-comp-list-select-item .xyg-comp-list-select-item-content{width:70%; height:2rem; text-align:left; float:left;overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;}
	.xyg-comp-list-select-item .xyg-comp-list-select-item-content input{width:100%; height:2rem; line-height:2rem;background-color:transparent;border:0; text-align:right;}
	.xyg-comp-xy{height:2rem; line-height:2rem; width:width:93%; margin:0px 2% 0px 5%;}
	.xyg-bottom{width:90%; height:auto;  margin:1.5rem 5%;}
  </style>
  </body>
  <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
  <script src="${s.base}/mobile/js/jquery-2.1.4.js"></script>
  <script src="${s.base}/mobile/js/jquery-weui.js"></script>
  <script src="${s.base}/mobile/fonts/iconfont.js"></script>
  <script src="${s.base}/mobile/js/H5Pay1.js?1454523"></script>
  <!--js分享代码开始-->
  <input type="hidden" value="${jSTicketShareResponse.appid}" id="appid" />
  <input type="hidden" value="${jSTicketShareResponse.fxTitle}" id="fxTitle" />
  <input type="hidden" value="${jSTicketShareResponse.fxImgUrl}" id="fxImgUrl" />
  <input type="hidden" value="${jSTicketShareResponse.fxDesc}" id="fxDesc" />
  <input type="hidden" value="${jSTicketShareResponse.fxUrl}" id="fxUrl" />
  <input type="hidden" value="${jSTicketShareResponse.nonceStr}" id="nonceStr" />
  <input type="hidden" value="${jSTicketShareResponse.timestamp}" id="timestamp" />
  <input type="hidden" value="${jSTicketShareResponse.signature}" id="signature" />
  <script src="${s.base}/mobile/js/share.js"></script>
  <!--js分享代码结束-->
  <script>
      var memberId = '${memberId}';
      var activityId='${activity.id}';
      $("#sexSelect").select({
          title: "选择性别",
          items: ["男","女"],
          onClose: function (d) {
              $("#sex").val(d.data.values);
              $("#sexSelect span").html(d.data.values);
          }
      });
      $("#gradeSelect").select({
          title: "选择单位名称",
          items:${departs},
          onClose: function (d) {
              $("#grade").val(d.data.values);
              $("#gradeSelect span").html(d.data.titles);
          }
      });

      $("#submitBtn").on("click",function(){
          var name = $("#name").val();
          if(name == null || name == "") {
              $.toast("请输入姓名", "text");
              return false;
          }
          var name = $("#name").val();

          var sex = $("#sex").val();
          if(sex == null || sex == "") {
              $.toast("请选择性别", "text");
              return false;
          }
          var grade = $("#grade").val();
          if(grade == null || grade == "") {
              $.toast("请选择单位名称", "text");
              return false;
          }
          var phone = $("#phone").val();
          if(phone == null || phone == "") {
              $.toast("请输入电话号码", "text");
              return false;
          }
          var param = {memberId:memberId,money:${activity.money},name:name,memberSex:sex,memberPhone:phone,memberGrade:grade,activityId:activityId};
          $.showLoading("正在提交中");
          $.post("/phone/activitySave",param,function(result){
              $.hideLoading();
              if(1==result.returnInfo.state){
                  if("2"==result.returnInfo.errorMsg){
                      //已交费
                      $.alert("您已经报名！", function() {
                          //点击确认后的回调函数
                          window.location.href="/phone/my?memberId=${memberId}";
                      });
                  }else{
                      //未交费
                      wxPay('${activity.money}','${member.openid}',result.returnInfo.errorMsg,'报名${activity.name}','${activity.id}','${memberId}');
                  }
              }else{
                  $.alert("该单位树苗已申领完毕");
                  //$.toast(result.returnInfo.errorMsg, "text");
              }
          },"json");
      });
  </script>
  
</html>

